package cn.cdutetc.servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "TestServlet", value = "/TestServlet")
public class TestServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setAttribute("user","server");

        request.getRequestDispatcher("/abc").forward(request,response);
        response.sendRedirect("/abc");
        ServletContext context=getServletContext();
        context.setAttribute("user","/abc");
        request.removeAttribute("user");
    }
}
